package com.yuba.common.translation.core.impl;

import com.yuba.common.core.domain.model.MessageMeta;
import com.yuba.common.json.utils.JsonUtils;
import com.yuba.common.translation.annotation.TranslationType;
import com.yuba.common.translation.constant.TransConstant;
import com.yuba.common.translation.core.TranslationInterface;
import lombok.AllArgsConstructor;
import org.springframework.stereotype.Component;

@Component
@AllArgsConstructor
@TranslationType(type = TransConstant.MESSAGE_META)
public class MessageMetaTranslationImpl implements TranslationInterface<MessageMeta> {
    @Override
    public MessageMeta translation(Object key, String other) {
        if (key instanceof String) {

            // JSON格式化
            return JsonUtils.parseObject((String) key, MessageMeta.class);
        }
        return null;
    }
}
